﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using eCRAM.Model;

namespace eCRAM.WebSite.Models
{
    /// <summary>
    /// Modèle pour les associations entre les utilisateurs et les activités
    /// </summary>
    public class UserActivityModel : IStatusableObject
    {
        /// <summary>
        /// /Identifiant
        /// </summary>
        public Guid Id { get; set; }
        /// <summary>
        /// Libellé de l'activité associé
        /// </summary>
        public string ActivityLabel { get; set; }
        /// <summary>
        /// Identifiant de l'activité associé
        /// </summary>
        public Guid ActivityId { get; set; }

        public ObjectStatus Status{ get; set; }

        public static UserActivityModel FromUserActivity(User_Activity userActivity)
        {
            return new UserActivityModel
                       {
                           Id = userActivity.Id,
                           ActivityId = userActivity.ActivityId,
                           ActivityLabel = userActivity.Activity.Name,
                           Status = userActivity.Status,
                       };
        }

        public static User_Activity ToUserActivity(UserActivityModel userActivity)
        {
            return new User_Activity
            {
                Id = userActivity.Id,
                ActivityId = userActivity.ActivityId,
                Status = userActivity.Status,
            };
        }
    }
}
